package org.holynite.fieldmanage.entities

import javax.persistence.*

/**
 * Created by midnite on 15/1/5.
 */
@Entity
@Table(name = "cash_record")
class CashierRecord implements Serializable {
	@Id
	@Column(name = "cash_record_serial")
	String serialId
	@Temporal(TemporalType.DATE)
	@Column(name = "record_date")
	Date recordDate
	@Column(name = "operator")
	String adminId
	@Transient
	Administrator operator
	@Column(name = "remains", nullable = false)
	Float remains = 0
	@Column(name = "borrowed", nullable = false)
	Float borrowed = 0
	@Transient
	Set<CashierRecordDetail> details

	boolean equals(o) {
		if (this.is(o)) return true
		if (getClass() != o.class) return false

		CashierRecord that = (CashierRecord) o

		if (serialId != that.serialId) return false

		return true
	}

	int hashCode() {
		return (serialId != null ? serialId.hashCode() : 0)
	}
}
